<#import "/manage/tpl/pageBase.ftl" as page>
<@page.pageBase currentMenu="添加扶贫人员">
<style>
	.td_right{text-align: right;}
</style>
<script type="text/javascript">

    function handleAddPovertyUser(){
        var _url = "handleAddPovertyUser";
        $.ajax(_url,{
            type: 'POST',
            data: $('#form').serialize(),
            success: function(data){
                alert("添加扶贫用户成功");
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
                alert("操作失败，请稍后重试!");
            }
        });
    }

	$(function() {
		 $("#username").focus();
	});
</script>
</head>

<body>
<#if e.id??>
    <#assign formAction="111">
<#assign insertAction=false />
<#else >
<#assign formAction="insert">
    <#assign insertAction=true />
</#if>

<#--<%-- formAction=<s:property value="#formAction"/><br> --%>-->
<#--<%-- formAction2=<s:property value="#request.formAction"/><br> --%>-->
<form action="${basepath}/manage/user/handleAddPovertyUser" id="form" method="post">
	<#--<s:form action="user!" namespace="/" theme="simple" id="form">-->
		<table class="table table-bordered">
			<tr>
				<td colspan="2" style="background-color: #dff0d8;text-align: center;">
					<strong>帐号编辑</strong>
				</td>
			</tr>
			<tr style="display:none;">
				<th>id</th>
				<td><input type="hidden" name="id" value="${e.id!""}"></td>
			</tr>
			<tr>
				<th class="td_right" style="padding-top: 15px">帐号</th>
				<td style="text-align: left;">
                    <#if insertAction>
                        <input type="text" name="username" id="username"  data-rule="帐号:required;username;length[4~20];remote[unique]">
                    <#else >
                        <input type="text" name="username" id="username" value="${e.username!""}">
                    </#if>
				</td>
			</tr>
			<tr>
				<th class="td_right" style="padding-top: 15px">昵称</th>
				<td style="text-align: left;">
				<input type="text" name="nickname" value="${e.nickname!""}" id="nickname"  data-rule="昵称:required;nickname;length[2~20];remote[unique, id]"/>
					</td>
			</tr>

                <tr>
                    <th class="td_right" style="padding-top: 15px">初始密码</th>
                    <td style="text-align: left;"><input type="text" name="password" placeholder="000000"
                                                              id="password"/>
                    </td>
                </tr>
            <tr>
                <th class="td_right" style="padding-top: 15px">邮箱</th>
                <td style="text-align: left;">
                    <input type="text" name="email" value="${e.email!""}" id="email"  data-rule="邮箱:required;email;length[5~20];remote[unique, id]"/>
                </td>
            </tr>

            <tr>
                <th class="td_right" style="padding-top: 15px">电话</th>
                <td style="text-align: left;">
                    <input type="text" name="phone" value="${e.phone!""}" id="phone"  data-rule="电话:required;phone;length[11];remote[unique, id]"/>
                </td>
            </tr>handleAddPovertyUser
			<tr>
				<td colspan="2" style="text-align: center;">
					<#if insertAction>
						<input type="submit" class="btn btn-success" value="添加"/>
                    </#if>
                    <input type="submit" class="btn btn-success" onclick="javascript:history.back(-1);" value="返回"/>
				</td>

			</tr>
		</table>
</form>
</@page.pageBase>